﻿<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css" />

@model IEnumerable<PessMvc.Models.ContractExpertModel>

@{
    ViewBag.Title = "Experts";
}
    <h2>选择专家</h2>
    <div id="m-op">
        @Html.ActionLink("添加评委", "AssignExperts", "Contract", new { contractID = (int)ViewBag.ContractID }, new { @class = "u-btn-a" })
    </div>


<fieldset>
    <div class="m-sd-xx m-sd-title">
        <div class="title">
            协议名称: @ViewBag.ContractTitle        
        </div>
        <div class="sidebd">
@{
    var grid = new WebGrid(Model, defaultSort: "Title", rowsPerPage:50);
}

            @using (Html.BeginForm("DismissExperts", "Contract", FormMethod.Post))
{
    @Html.Hidden("ContractID", (int)ViewBag.ContractID)
    @grid.GetHtml(columns: grid.Columns(
        grid.Column(header: "□",style:"u-chk-th", format: @<text><input name="expertSN" type="checkbox" value="@item.SerialNumber" /></text>),
        grid.Column("SerialNumber", header: "评委编号", style:"col1"),
        grid.Column("IsContractSigned", header: "已签", style:"col1"),
        grid.Column("RealName", header: "真实姓名", style:"col2"),
        grid.Column("Gender", header: "性别", style:"col3", format: @<text>@Utility.TranslateGender(item.Gender)</text>),
        grid.Column("Birthdate", header: "出生年月", style: "col4"),
        grid.Column("Phone", header: "电话", style: "col5"),
        grid.Column("ContactAddress", header: "通讯地址", style: "col5"),
        grid.Column("ZipCode", header: "邮政编码", style: "col5")
    ))
    <div style="padding-top:10px">
        <input type="submit" value="移除评委" class="u-btn u-btn-del-pw" />
        @Html.ActionLink("完成", "Index", "Contract", new { @class = "u-btn" })
    </div>
}
            </div>
        </div>

</fieldset>

<script language="javascript">
    function chk_select() {
        for (i = 0; i < document.getElementsByClassName("u-chk-th").length; i++) {
            if (document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].getElementsByTagName("input")[0].checked) {
                document.getElementsByClassName("u-chk-th")[i].getElementsByTagName("input")[0].checked = true;
            } else {
                document.getElementsByClassName("u-chk-th")[i].getElementsByTagName("input")[0].checked = false;
            }
        }
    }
    function chk_click() {
        tmp=0;
        for (i = 0; i < document.getElementsByClassName("u-chk-th").length; i++) {
            if (document.getElementsByClassName("u-chk-th")[i].getElementsByTagName("input")[0].checked) {
                tmp++
            }
        }
        if (tmp == document.getElementsByClassName("u-chk-th").length) {
            document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].getElementsByTagName("input")[0].checked = true;
        }
        else {
            if (tmp == 0) {
                document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].getElementsByTagName("input")[0].checked = false;
            }
        }
    }
    document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].onclick = chk_select;
    document.getElementsByTagName("table")[0].getElementsByTagName("th")[0].innerHTML = "<input type='checkbox' name='fly-chk' id='fly-chk'>";//"选中/取消选中";
    for (j = 0; j < document.getElementsByClassName("u-chk-th").length; j++) {
        document.getElementsByClassName("u-chk-th")[j].getElementsByTagName("input")[0].onclick = chk_click;
    }
</script>
